<?php
/**
 * BQue Description
 * @package core
 * @name Model
 * @filesource Model.php
 * @author Meta Sanjaya
 */

class Model
{
    /**
     * @access protected
     * @var Class $db
     */
    public $db;

    /**
     * @access public
     * @method __construct
     * @param void
     * @return void
     */
    public function __construct()
    {
        $this->db = Database::initialize(getInstance('config')->get('db_host'), getInstance('config')->get('db_username'), getInstance('config')->get('db_password'), getInstance('config')->get('db_name'), getInstance('config')->get('db_prefix'));
    }

    public function getModel($app)
    {
        try {
            $model = 'model_' . $app;
            include_once __APP__ . $app . DIRECTORY_SEPARATOR . $model . '.php';
            return(new $model);
        } catch(Exception $e) {
            trigger_error($e->getMessage());
        }
    }
}
?>
